package com.moyu.article.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moyu.article.domain.board.Board;
import com.moyu.article.domain.board.vo.BoardQueryVO;
import com.moyu.article.domain.post.Post;
import com.moyu.article.domain.post.dto.*;
import com.moyu.article.domain.post.vo.BoardOptionVO;
import com.moyu.article.domain.post.vo.PostListVO;
import com.moyu.article.domain.post.vo.PostQueryVO;
import com.moyu.article.domain.post.vo.PostVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @Author 赵彦博
 * @Date 2025/3/29 19:04
 */
@Mapper
public interface PostMapper  extends BaseMapper<Post> {
    List<PostVO> getPostList(PostQueryDTO postQueryDTO);

    int updatePost(PostUpdateStateDTO postUpdateStateDTO);


    int updatePostState(String postId, int state);

    List<PostListVO> getListByNewest(PostQueryListDTO dto);

    List<PostListVO> getListByHot(PostQueryListDTO dto);

    List<PostListVO> getListByUnanswered(PostQueryListDTO dto);

    void batchInsertBoardPost(List<Map<String, Object>> batchList);

    PostVO getPostById(Long postId);

    int updateVisitCount(Long postId);

    Boolean getIsLike(String postId, String userId);

    int insertLikeWithPost(String postId, String userId);

    int deleteLikeWithPost(String postId, String userId);

    PostQueryVO selectPostById(Long postId);
    int updatePostVisitCount(Long postId);
    List<BoardQueryVO> selectBoardsByPostId(Long postId);
    int checkPostLikeStatus(@Param("postId") Long postId, @Param("userId") Long userId);
    int countPostLikes(Long postId);

    int deletePost(String postId);

    int updatePostByUser(PostUpdateDTO dto);

    Boolean checkFavoriteStatus(String postId, String userId);

    int favoritePost(String postId, String userId);

    int cancelFavoritePost(String postId, String userId);
}
